package hidalgo.expenses.activity;

import hidalgo.expenses.utils.Util;
import android.app.Activity;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class BaseActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		// prevent the default title-bar from being displayed
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		
		//avoid showing the keyboard by default
		getWindow().setSoftInputMode(
				WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
		
		//register broadcast receiver for connectivity
		registerReceiver(Util.connectionReceiver, new IntentFilter(
				ConnectivityManager.CONNECTIVITY_ACTION));
	}
	
	@Override
	protected void onDestroy() {
		super.onDestroy();
		
		//unregister broadcast receiver for connectivity
		unregisterReceiver(Util.connectionReceiver);
		
	}

}
